<template>
	<view>
		<view class="formList">
			<zy-forms :model="formData" border labelWidth="120">
				<zy-form-item :label="$t('public.productionNo')+$t('public.colon')"><text
						class="formText">{{formData.saleOrderNo || $t('public.null')}}</text>
				</zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.taskOrder')+$t('public.colon')"><text
						class="formText">{{formData.productionNo || $t('public.null')}}</text>
				</zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.poductionNum')+$t('public.colon')"><text
						class="formText">{{formData.bindingNo || $t('public.null')}}</text>
				</zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.partName')+$t('public.colon')"><text
						class="formText">{{formData.partName || $t('public.null')}}</text>
				</zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.batchColor')+$t('public.colon')"><text
						class="formText">{{formData.color || $t('public.null')}}</text></zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.batchSize')+$t('public.colon')"><text
						class="formText">{{formData.size || $t('public.null')}}</text></zy-form-item>
				<zy-form-item :label="$t('homepage.ProductionMonitor.batchNum')+$t('public.colon')"><text
						class="formText">{{formData.perBindNum || $t('public.null')}}</text>
				</zy-form-item>
				<zy-form-item :label="$t('public.remarkInfo')+$t('public.colon')"><text
						class="formText">{{formData.remarks || $t('public.null')}}</text></zy-form-item>
			</zy-forms>
		</view>
		<!-- 底部按钮固定 -->
		<bottomBtn class="bottomBtn" fixed :leftText="$t('homepage.ProductionMonitor.processData')"
			:rightText="$t('public.submit')" @rightBtn="submitBtn" @leftBtn="attachBtn">
		</bottomBtn>
	</view>
</template>

<script>
	import {
		saveTaskReport
	} from "@/api/homepage.js"
	export default {
		data() {
			return {
				//表单数据
				formData: {
					saleOrderNo: '',
					productionNo: '',
					partName: '',
					color: '',
					size: '',
					bindingNo: '',
					perBindNum: '',
					remarks: '',
				},
			}
		},
		onLoad(option) {
			//每次进入表单置空再赋值
			let formData = {}
			// formData = this.$store.state.findCardInfoByNoData
			formData = option
			this.formData = formData
		},
		methods: {
			//工艺资料
			attachBtn() {
				uni.navigateTo({
					url: "./ProcessData/index"
				})
			},
			//提交
			submitBtn() {
				saveTaskReport({
					equipmentId: this.$store.state.loginId, //设备id:通过设备登录后获得的id
					cardId: this.$store.state.findCardInfoByNoData.id, //卡信息中的id
					productionTaskId: this.$store.state.findCardInfoByNoData
						.productionTaskId, //卡信息中的productionTaskId
					cuttingSheetId: this.$store.state.findCardInfoByNoData.cuttingSheetId, //卡信息中的cuttingSheetId
					procedureName: this.$store.state.procedureNameData, //工序名称 当前平板设置的工序名称
					procedureId: this.$store.state.procedureIdData, //工序id  当前平板设置的工序id 
					billType: "0"
				}).then((res) => {
					uni.redirectTo({
						url: "../index"
					})
					setTimeout(function() {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 3000
						})
					}, 200);
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: "none",
						duration: 3000
					})
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.formList {
		background-color: #fff;
		margin: 20rpx;
		padding-bottom: 10rpx;
		border-radius: 10rpx;
	}
</style>